﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.Xna.Framework.Graphics;

using TomShane.Neoforce.Controls;

namespace tactics.GUI.Menu
{
    class MainMenuScreen : GameStateManagement.GameScreen
    {
        Manager guiManager;
        Panel background;
        Button testMenuItem;
        Button quit;

        public MainMenuScreen(Manager guiManagerIn)
        {
            guiManager = guiManagerIn;

            this.TransitionOffTime = TimeSpan.FromSeconds(0.5);

            //Temp stuff
            background = new Panel(guiManager);
            background.Init();
            background.Width = guiManager.GraphicsDevice.DisplayMode.Width;
            background.Height = guiManager.GraphicsDevice.DisplayMode.Height;

            testMenuItem = new Button(guiManager);
            testMenuItem.Init();
            testMenuItem.Text = "Play Tactics!";
            testMenuItem.Width = 150;
            testMenuItem.Height = 50;
            testMenuItem.Top = (background.Height / 2) - (testMenuItem.Height / 2);
            testMenuItem.Left = (background.Width / 2) - (testMenuItem.Width / 2);
            testMenuItem.BackColor = Color.Gray;
            testMenuItem.Passive = false;
            testMenuItem.Click += new TomShane.Neoforce.Controls.EventHandler(testMenuItem_Click);

            quit = new Button(guiManager);
            quit.Init();
            quit.Text = "Exit";
            quit.Width = 150;
            quit.Height = 50;
            quit.BackColor = Color.Gray;
            quit.Top = (background.Height / 2) - (quit.Height / 2) + 200;
            quit.Left = (background.Width / 2) - (quit.Width / 2);
            quit.Click += new TomShane.Neoforce.Controls.EventHandler(quit_Click);

            guiManager.Add(background);
            background.Add(testMenuItem);
            background.Add(quit);
        }

        void quit_Click(object sender, TomShane.Neoforce.Controls.EventArgs e)
        {
            TacticsEngine.Instance.Exit();
        }

        ~MainMenuScreen()
        {
        }

        void testMenuItem_Click(object sender, TomShane.Neoforce.Controls.EventArgs e)
        {
            TacticsEngine.Instance.StartGame();
            guiManager.Remove(background);
            ExitScreen();
        }

    }
}
